package com.jackchan.homework.sysw.web;

import com.jackchan.homework.common.web.BaseController;
import com.jackchan.homework.sysw.service.OrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by ch-hui on 16/2/10.
 */

@Controller
@RequestMapping("order")
public class OrderController extends BaseController {

    private static final String BIZ_BASE = "sysw/order/";

    @Autowired
    private OrderService orderService;

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView list() {
        ModelAndView mv = new ModelAndView(BIZ_BASE + "order_list");
        mv.addObject("orders", orderService.findAllOrderDtoes());
        return mv;
    }

    @RequestMapping(value = "edit/{id}", method = RequestMethod.GET)
    public ModelAndView editForm(@PathVariable Long id) {
        ModelAndView mv = new ModelAndView(BIZ_BASE + "order_more");
        return mv;
    }

    @RequestMapping(value = "print/{id}", method = RequestMethod.GET)
    public ModelAndView print(@PathVariable Long id){
        ModelAndView mv = new ModelAndView(BIZ_BASE + "order_print");
        return mv;
    }

}
